home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / iau19e.zip / FLOPINFO.C < prev    next >
C/C++ Source or Header  |  1991-02-03  |  3KB  |  98 lines

  1. #define MYREV 'A'
  2. /*
  3.  * FLOPINFO -- a Turbo 'C' program which will display the current drive
  4.  * parameters for your floppy disk(s).  Compiled using version 1.5 of Turbo
  5.  * 'C'.  This program is released into the public domain 8/29/88.  This is
  6.  * NOT a shareware program. It might or might not be supported by the author. 
  7.  *
  8.  * Original code:    8/29/88 D. Bushong This revision:  A  (original) 
  9.  *
  10.  
  11. Revision history 
  12. ========================== 
  13. REV    DATE    BY    Reason for mod / effect obtained 
  14. ======= ======= ======= ================================================== 
  15.     A    2/ 3/91 Bushong    Change of address (no functional changes)
  16.     B     /  / 
  17.     C     /  / 
  18.  
  19.  *
  20.  */
  21.  
  22. #include <bios.h>
  23. #include <mem.h>
  24. #include <conio.h>
  25. #include <dos.h>
  26. #include <process.h>
  27.  
  28. typedef unsigned char BYTE;
  29. typedef unsigned WORD;
  30.  
  31. struct table {
  32.     unsigned hut:4, srt:4, nd:1, hlt:7;
  33.     char motor, bpsec, last_sec, gap, data, gap_format, fmt_data, settle, startup;
  34. };
  35. #if ((sizeof(struct table))!=11)
  36. ***Alignment error ! Must be byte - aligned structures ! ***
  37. #endif
  38.  
  39. #if (MYREV=='A')
  40. #define MODBY ""
  41. #else
  42. #define MODBY "Modified 00/00/00 by [yourname]"
  43. #endif
  44.  
  45. void hello(void)
  46. {
  47.      clrscr();
  48.     gotoxy(1, 2);
  49.     cprintf("   FLOPINFO.... display floppy disk information from BIOS and drive table\r\n");
  50.     cprintf("   (%c)   Public domain software from Dave Bushong, Dracut, MA 01826\r\n", MYREV);
  51.     gotoxy(1, 25);
  52.     cprintf("%79s\r\n", MODBY);
  53. }
  54.  
  55. struct table far *tp;
  56. unsigned char far *bp;
  57. extern _8087;
  58. void main(void)
  59. {
  60.     /*
  61.      * this program will show what the BIOS thinks is going on with the
  62.      * floppy. 
  63.      */
  64.  
  65.      lowvideo();
  66.     _8087 = 0;
  67.     tp = (struct table far *) getvect(0x1e);
  68.     bp = (char far *) tp;
  69.  
  70.     hello();
  71.  
  72.     gotoxy(1, 4);
  73.     lowvideo();
  74.  
  75.     cprintf("The eleven entries in the disk base table at %Fp are:\r\n\r\n", tp);
  76.     highvideo();
  77.     cprintf("%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\r\n\r\n",
  78.         bp[0], bp[1], bp[2], bp[3], bp[4], bp[5], bp[6], bp[7], bp[8], bp[9], bp[10]);
  79.  
  80.     lowvideo();
  81.  
  82.     cprintf("                        Step-rate time: %d msec.\r\n", 16 - (tp->srt));
  83.     cprintf("                      Head unload time: %d msec.\r\n", 16 * tp->hut);
  84.     cprintf("                        Head-load time: %d msec.\r\n", 2 * tp->hlt);
  85.     cprintf("                              DMA mode: %s\r\n", (tp->nd == 0) ? "Yes" : "No");
  86.  
  87.     cprintf("      Wait time until motor turned off: %0.1g seconds\r\n", (float) (tp->motor) * (.054931));
  88.  
  89.     cprintf("                      Bytes per sector: %d\r\n", 128 << tp->bpsec);
  90.     cprintf("                    Last sector number: %d\r\n", tp->last_sec);
  91.     cprintf("            Gap length between sectors: %d\r\n", tp->gap);
  92.     cprintf("Data length (if unknown sector length): %d\r\n", tp->data);
  93.     cprintf("      Gap length for format operations: %d\r\n", tp->gap_format);
  94.     cprintf("Data value stored in formatted sectors: %02X\r\n", tp->fmt_data);
  95.     cprintf("                      Head settle time: %d millisecond%s\r\n", tp->settle, tp->settle == 1 ? "" : "s");
  96.     cprintf("                          Startup time: %0.1g second%s\r\n", 0.125 * (float) tp->startup, tp->startup == 8 ? "" : "s");
  97. }
  98.